package com.hejr.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hejr.entity.User;
import com.hejr.mapper.UserMapper;
import com.hejr.service.IUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: hejr
 * @desc:
 * @date: 2019/4/8 13:26
 */
@Service
@DS("master")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {


    @DS("slave")
    @Override
    public Integer addUserToSlave(User user) {
        return baseMapper.insert(user);
    }

    @Override
    public Integer addUserToMaster(User user) {
        return baseMapper.insert(user);
    }


    @Override
    public List<User> findMasterUserList() {
        return baseMapper.selectList(null);
    }

    @DS("slave")
    @Override
    public List<User> findSlaveUserList() {
        return baseMapper.selectList(null);
    }
}
